import React from 'react'
import {connect,} from 'react-redux'

const OnLiveHeaderFullScreenComments = props => {

    // 评论列表
    const comments = props.dialogues
    const commentsTemplate = (
        <div className='live-room-header-player-full-comments-ctn'>
            <p className='live-room-header-player-full-comments-title'>评论</p>
            <div className='live-room-header-player-full-comments-sub-ctn'>
                {comments.map((comment, i) => {

                    const userMsg = (
                        <div key={i} className='live-room-header-player-full-comments-item'>
                                <span className='live-room-header-player-full-comments-item-name'>
                                    {comment.Nickname}:&nbsp;
                                </span>
                            <span>
                                {comment.msg}
                            </span>
                        </div>
                    )

                    const welcomeMsg = (
                        <div key={i} className='live-room-header-player-full-comments-item flex-center-align-center'>
                            <span>
                                欢迎
                            </span>
                            <span
                                className='live-room-header-player-full-comments-item-name-welcome'
                            >
                                &nbsp;&nbsp;{comment.nickname}&nbsp;&nbsp;
                            </span>
                            <span>
                                光临直播间
                            </span>
                        </div>
                    )

                    const m = {
                        1: userMsg,
                        2: null,
                        3: welcomeMsg
                    }

                    let {c,} = comment
                    return m[c]
                })}
            </div>
        </div>
    )

    return commentsTemplate

}

const mapState = state => ({
    dialogues: state.chat.dialogues,
})

export default connect(mapState, null)(OnLiveHeaderFullScreenComments)
